﻿@page "/admin/about"
@using System.Diagnostics
@using Moonglade.Utils
@inject IWebHostEnvironment WebHostEnvironment
@inject IConfiguration Configuration

@{
    var process = Process.GetCurrentProcess();
}

<div class="pb-3">
    <h4 class="admin-subtitle fw-bold mb-2">
        @SharedLocalizer["Moonglade Configuration"]
    </h4>

    <div class="mb-4 rounded-3 shadow-sm border bg-white p-2">
        <table class="table table-borderless table-sm mb-0">
            <tbody>
                <tr>
                    <td class="w-25">@SharedLocalizer["Version"]</td>
                    <td class="text-muted">@Helper.AppVersion</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Environment"]</td>
                    <td class="text-muted">@WebHostEnvironment.EnvironmentName</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Editor"]</td>
                    <td class="text-muted">@(Configuration.GetSection("Editor").Get<EditorChoice>())</td>
                </tr>

                <tr>
                    <td>Forwarded Headers</td>
                    <td class="text-muted">@Configuration["ForwardedHeaders:Enabled"]: @Configuration["ForwardedHeaders:HeaderName"]</td>
                </tr>

                <tr>
                    <td>Client IP Address</td>
                    <td class="text-muted">@HttpContext.Connection.RemoteIpAddress?.ToString()</td>
                </tr>
            </tbody>
        </table>
    </div>

    <h4 class="admin-subtitle fw-bold mb-2">
        @SharedLocalizer["Server Information"]
    </h4>

    <div class="mb-4 rounded-3 shadow-sm border bg-white p-2">
        <table class="table table-borderless table-sm mb-0">
            <tbody>
                <tr>
                    <td class="w-25">@SharedLocalizer["System"]</td>
                    <td class="text-muted">@Helper.TryGetFullOSVersion() @(Environment.Is64BitOperatingSystem ? "(64-bit)" : "(32-bit)")</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Directory"]</td>
                    <td class="text-muted">@Environment.CurrentDirectory</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Machine Name"]</td>
                    <td class="text-muted">@Environment.MachineName</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["User Name"]</td>
                    <td class="text-muted">@Environment.UserDomainName\@Environment.UserName</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Server Time Zone"]</td>
                    <td class="text-muted">@TimeZoneInfo.Local.Id</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer[".NET Version"]</td>
                    <td class="text-muted">@Environment.Version</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["ASP.NET Core Environment"]</td>
                    <td class="text-muted">@(Environment.GetEnvironmentVariable("aspnetcore_environment"))</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Worker Process"]</td>
                    <td class="text-muted">[@process.Id] @process.ProcessName @(Environment.Is64BitProcess ? "(64-bit)" : "(32-bit)")</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Start Time"]</td>
                    <td class="text-muted">@process.StartTime.ToUniversalTime() (UTC)</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Memory"]</td>
                    <td class="text-muted">@(process.WorkingSet64 / 1024 / 1024) MB</td>
                </tr>
                <tr>
                    <td>@SharedLocalizer["Docker Container"]</td>
                    <td class="text-muted">@Helper.IsRunningInDocker()</td>
                </tr>

                @if (Helper.IsRunningOnAzureAppService())
                {
                    <tr>
                        <td>@SharedLocalizer["Azure App Service"]</td>
                        <td class="text-muted">
                            WEBSITE_SKU : @Environment.GetEnvironmentVariable("WEBSITE_SKU") <br />
                            WEBSITE_SITE_NAME: @Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") <br />
                            WEBSITE_HOSTNAME : @Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME") <br />
                            REGION_NAME  : @Environment.GetEnvironmentVariable("REGION_NAME") <br />
                        </td>
                    </tr>
                }

                @if (Request.Headers.ContainsKey("X-Azure-FDID"))
                {
                    <tr>
                        <td>@SharedLocalizer["Azure Front Door"]</td>
                        <td class="text-muted">
                            X-Azure-FDID: @Request.Headers["X-Azure-FDID"]
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>

    <a class="btn btn-sm btn-outline-accent" data-bs-toggle="modal" data-bs-target="#legalModal">@SharedLocalizer["Legal Infomation"]</a>

    <a class="btn btn-sm btn-outline-accent" href="https://github.com/EdiWang/Moonglade/issues" target="_blank">
        <i class="bi-bug"></i>
        Report an issue
    </a>
</div>

<div class="modal modal-lg fade" id="legalModal" tabindex="-1" role="dialog" aria-labelledby="legalModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="legalModalLabel">@SharedLocalizer["Legal Infomation"]</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
                </button>
            </div>

            <div class="modal-body">
                <h5>Disclaimer</h5>
                <p>
                    The following disclaimer applies to the software named "Moonglade" developed by Edi Wang and other <a href="https://github.com/EdiWang/Moonglade/graphs/contributors" target="_blank">contributors</a> (hereinafter referred to as "the software developer"):
                </p>
                <p>
                    This project is not affiliated with Microsoft Corporation. All product names, logos, and brands are property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.
                </p>
                <p>
                    The software developer does not provide any warranties or guarantees regarding the functionality, performance, or suitability of Moonglade for any specific purpose. The software is provided "as is," and the software developer shall not be held liable for any direct or indirect damages arising from the use or inability to use Moonglade.
                </p>

                <h6>Data Privacy</h6>
                <p>
                    Moonglade does not send any user data or information to any government, <strong>including the Chinese government</strong>. The software is designed to prioritize and respect user privacy.
                </p>

                <h6>Data Collection</h6>
                <p>
                    While using Moonglade, please note that the platform on which you deploy the software may collect data and usage information. This data collection is solely the responsibility of the platform and not the software developer. We encourage you to review thier privacy policy and terms of service of the platform to understand how your data is handled.
                </p>

                <h6>User Responsibility</h6>
                <p>
                    As a user of Moonglade, it is your responsibility to ensure compliance with applicable laws and regulations regarding data privacy and usage. The software developer shall not be held liable for any misuse, unauthorized access, or mishandling of data by the user or the platform on which Moonglade is deployed.
                </p>

                <h6>Updates and Modifications</h6>
                <p>
                    The software developer may release updates or modifications to Moonglade from time to time. It is recommended that users stay informed about these updates and apply them to ensure optimal performance and security.
                </p>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-outline-accent" data-bs-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
